<?php
class MovealbumsForm extends BaseForm {
	private $albums; 
	private $selected; 
	private $users;
	
	private $searchUserId; 
	private $moveUserId; 
	
	public function MovealbumsForm() {
		parent::BaseForm();
	}
	
	public function clear(){
		$this->albums = array();
		$this->selected = array();
		$this->users = array();

		$this->searchUserId = null;
		$this->moveUserId = null;
	}
	
	public function setAlbums($val){$this->albums = $val;}
	public function setSelected($val){$this->selected = $val;}
	public function setUsers($val){$this->users = $val;}
	public function setSearchUserId($val){$this->searchUserId = $val;}
	public function setMoveUserId($val){$this->moveUserId = $val;}
	
	public function getAlbums(){ return $this->albums; }
	public function getSelected(){ return $this->selected; }
	public function getUsers(){ return $this->users; }
	public function getSearchUserId(){ return $this->searchUserId; }
	public function getMoveUserId(){ return $this->moveUserId; }
	
	public function getSelectedAlbums(){
		$arr = array();
		
		foreach($this->albums as $current){
			$id = $current->getId();
			
			if(array_key_exists($id, $this->selected)){
				$arr[] = $current; 
			}
		}
		
		return $arr; 
	}
	
	public function removeAlbums($ids){
		$arr = array();
		
		$flip = array_flip($ids);
		foreach($this->albums as $current){
			$id = $current->getId();
			
			if(! array_key_exists($id, $flip)){
				$arr[] = $current;
			}
		}
		
		$this->setAlbums($arr);
	}
	
} 
?>
